using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class GameUI : MonoBehaviour
{
    public Text health;

    public Text Grenade;

    public GameObject Start;

    public GameObject complete;

    public Slider bosshealthBar;
    
    public void UpdatebossSlider(int curhealth)
    {
        bosshealthBar.value = curhealth;
    }

    public void UpdateHealth(int num)
    {
        health.text = num.ToString();
    }

    public void UpdateGrenade(int num)
    {
        Grenade.text = num.ToString();
    }

    public void ShowStart()
    {
        Start.SetActive(true);
        StartCoroutine(HideStart());
    }

    private IEnumerator HideStart() 
    { 
        Soundmgr.Instance.PlayMusicByName("Mission 1 Start",Camera.main.transform.position,0.6f);
        yield return new WaitForSeconds(2f);
        Start.SetActive(false);
    }

    public void ShowComplete()
    {
        complete.SetActive(true);
        StartCoroutine(HideComplete());
    }

    private IEnumerator HideComplete()
    {
        Soundmgr.Instance.PlayMusicByName("Mission Complete",Camera.main.transform.position,0.3f);
        yield return new WaitForSeconds(3.5f);
        SceneManager.LoadScene(0);
    }

}
